feat: add zccrs' spdx-checker for checking copyright year#777
Draft
BLumia wants to merge 1 commit intolinuxdeepin:masterfrom
Draft
feat: add zccrs' spdx-checker for checking copyright year#777BLumia wants to merge 1 commit intolinuxdeepin:masterfrom
BLumia wants to merge 1 commit intolinuxdeepin:masterfrom
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: BLumia The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
deepin pr auto review这段代码是向 GitHub Actions 工作流中添加了一个新的 Job,用于检查源代码文件的 SPDX 版权声明。整体逻辑清晰,使用了社区现成的 Action 工具。 以下是对该代码的审查意见,分为语法逻辑、代码质量、代码性能和代码安全四个方面: 1. 语法逻辑
2. 代码质量
3. 代码性能
4. 代码安全
改进后的代码示例结合以上建议,改进后的代码片段如下: Check-SPDX-Copyright:
runs-on: ubuntu-latest
# 显式设置最小权限
permissions:
contents: read
# 如果希望在其他检查通过后再运行,取消下面的注释并根据需要修改依赖的 Job 名称
# needs: [job_name_1, job_name_2]
steps:
- uses: actions/checkout@v5
with:
# 确保只在 PR 上下文中有效,否则可能需要处理非 PR 的情况
ref: ${{ github.event.pull_request.head.sha }}
- uses: zccrs/github-actions-spdx-checker@v1 # 建议替换为具体的 commit SHA 以提高安全性
with:
base: origin/master
include: '*.py,*.js,*.jsx,*.tsx,*.java,*.cpp,*.c,*.h,*.hpp,*.go,*.rs,*.rb,*.php,*.sh,*.xml,*.yaml,*.yml,*.qml,CMakeLists.txt,Makefile'
exclude: 'vendor/**,node_modules/**'
# 建议将持有者名称提取为变量,方便统一管理
holder: '*UnionTech*'总结这段代码逻辑基本正确,能够实现检查版权的目的。主要的改进点在于安全性(锁定第三方 Action 版本、限制权限)和健壮性(明确触发条件和依赖关系)。 |
BLumia
commented
Jan 22, 2026
| - uses: actions/checkout@v5 | ||
| with: | ||
| ref: ${{ github.event.pull_request.head.sha }} | ||
| - uses: zccrs/github-actions-spdx-checker@v1 |
Member
Author
There was a problem hiding this comment.
Note to self:需等待 zccrs/github-actions-spdx-checker 补充 v1 tag,或转用 @main
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.